<template>
  <view class="tab">
    <view class="tab-box" @click="switchTab(indexPage)">首页</view>
    <view class="tab-box" @click="switchTab(followPage)">关注</view>
    <view class="tab-box svg-tab">
      <view
        class="icon-box"
        @mouseenter="hovering = true"
        @mouseleave="hovering = false"
      >
        <i
          class="iconfont icon-add icon-center add-icon"
          :style="{ color: svgColor }"
        ></i>
      </view>
    </view>
    <view class="tab-box" @click="switchTab(messagePage)">消息</view>
    <view class="tab-box" @click="switchTab(mePage)">我</view>
  </view>
</template>

<script>
  import { followPage, indexPage, mePage, messagePage } from "@/API/pageConst";

  export default {
    name: "tab",
    components: {},
    data() {
      return {
        hovering: false,
        indexPage,
        followPage,
        messagePage,
        mePage,
      };
    },
    computed: {
      svgColor() {
        return this.hovering ? "#5555ff" : "#000000";
      },
    },
    methods: {
      switchTab(path) {
        uni.switchTab({
          url: path,
        });
      },
    },
  };
</script>

<style>
  .icon-center {
    font-size: 20px;
    height: 20px;
  }
  .tab {
    height: 50px;
    width: 100%;
    position: fixed;
    bottom: 0;
    left: 0;
    display: flex;
    background-color: #000000 !important;
    backdrop-filter: none !important; /* 确保没有 backdrop-filter */
    z-index: 999;
  }
  .tab-box {
    flex: 1;
    color: #ffffff;
    background-color: #000000;
    text-align: center;
    height: 50px;
    line-height: 50px;
    z-index: 999;
  }
  .icon-center {
    height: 50px;
    line-height: 50px;
  }
  .icon-box {
    width: 60%;
    height: 30px;
    background: #ffffff;
    margin: 10px auto;
    line-height: 30px;
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
  }
</style>
